# 列表生成式(List Comprehensions)是Python特有的用来创建list的生成式。
# 语法：[x for x in range(10)]

list = [x*x for x in range(10)]
print(list)


print("----------------相当于-------------------------")
list = []
for x in range(1,10):
    list.append(x*x)
print(list)


print("----------------for循环后面还可以加上if判断-------------------------")
list = [x*x for x in range(1,10) if x%2==0]
print(list)

print("-----------------------笛卡尔积-------------------------------")
a = "AB"
b = "XYZ"
list = [m+n for m in a for n in b]
print(list)

print("------------------大写转小写------------------")
list = [s.lower() for s in ["DFQ","love","zyt"]]
print(list)






